<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateNewsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('news', function (Blueprint $table) {
            $table->bigIncrements('id')->comment('自增ID');

            $table->string('title', 300)->comment('标题');
            $table->string('content', 2000)->comment('内容');
            $table->string('image', 500)->comment('图片');
            $table->unsignedTinyInteger('type')->default(1)->comment('类型 1、文化信息 2、新闻资讯 3、志愿者资讯');
            $table->unsignedTinyInteger('sort')->default(0)->comment('排序');
            $table->unsignedBigInteger('publisher_uid')->comment('发布者uid')->index();

            $table->timestamps();
            $table->softDeletes();

            $table->engine = 'InnoDB';

        });
        DB::statement("alter table `news` comment'资讯表'");

        
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('news');
    }
}
